<div class="main-header">
    <div class="btn-list">
        <a href="javascript:void(0)" id="newItem" ng-click="edit()">
            <span class="glyphicon glyphicon-plus"></span>新增故障
        </a>
    </div>
</div>
<div class="main-con">
    <div class="row">
        <!--list -->
        <div class="col-xs-4">
            <div class="lft-wrap box-shadow" when-scrolled="getDeviceList()">
                <search-box search-list="searchList" search-result="searchResult" search-url="/search/type"></search-box>
                <ul class="data-list" repeat-list="getRgtModel()" active-id="{{activeId}}">
                    <li ng-repeat="item in deviceList track by $index" relativeId="{{item.Id}}" ng-class="{active:$index==0}">
                        <div class="media-left">
                            <div class="icon-box">
                                <img ng-if="item.Icon" class="media-object img-circle" alt="" width="60" height="60" ng-src="{{item.Icon}}">
                                <i ng-if="!item.Icon" class="glyphicon glyphicon-th-large"></i>
                            </div>
                        </div>
                        <div class="media-body">
                            <div class="panel-info">
                                <dl>
                                    <dt>故障编号:</dt>
                                    <dd ng-bind="item.Code"></dd>
                                </dl>
                                <dl>
                                    <dt>状态:</dt>
                                    <dd ng-bind="item.DeviceTypeName"></dd>
                                </dl>
                                <dl>
                                    <dt>紧急程度:</dt>
                                    <dd ng-bind="DeviceStatus|getEmunName:item.DeviceStatus"></dd>
                                </dl>
                                <dl>
                                    <dt>上报时间:</dt>
                                    <dd ng-bind="item.Name"></dd>
                                </dl>
                                <dl>
                                    <dt>故障描述:</dt>
                                    <dd ng-bind="item.Spec"></dd>
                                </dl>
                            </div>
                        </div>
                        <div class="media-right">
                            <div class="btn-wrap">
                                <a href="javascript:void(0)" title="编辑" ng-click="edit(item.Id,$index);$event.stopPropagation();">
                                    <span class="glyphicon glyphicon-edit"></span></a>
                                <a href="javascript:void(0)" title="删除" ng-click="del(item,$index);$event.stopPropagation();">
                                    <span class="glyphicon glyphicon-trash"></span></a>
                            </div>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
        <!--内容块-->
        <div class="col-xs-8">
            <div class="rgt-wrap box-shadow" when-scrolled="getRecordList()">
                <div class="widget flat radius-bordered">
                    <tabset flat="true">
                        <tab heading="位置信息">
                            <wt-map mapid="map1" height="mapheight" showgdmap="false" map-intialed="mapIntialed(this)"></wt-map>
                        </tab>
                        <tab heading="详细信息">
                            <div class="row">
                                <div class="panel-info report">
                                    <dl>
                                        <dt>故障编号:</dt>
                                        <dd ng-bind="deviceDetailModel.Code"></dd>
                                    </dl>
                                    <dl>
                                        <dt>状态:</dt>
                                        <dd ng-bind="deviceDetailModel.DeviceTypeName"></dd>
                                    </dl>
                                    <dl>
                                        <dt>故障位置:</dt>
                                        <dd ng-bind="DeviceStatus|getEmunName:deviceDetailModel.DeviceStatus"></dd>
                                    </dl>
                                    <dl>
                                        <dt>上报时间:</dt>
                                        <dd ng-bind="deviceDetailModel.Name"></dd>
                                    </dl>
                                    <dl>
                                        <dt>上报人员:</dt>
                                        <dd ng-bind="deviceDetailModel.Spec"></dd>
                                    </dl>
                                    <dl>
                                        <dt>维修任务编号:</dt>
                                        <dd ng-bind="deviceDetailModel.Contact"></dd>
                                    </dl>
                                    <dl>
                                        <dt>紧急程度:</dt>
                                        <dd ng-bind="deviceDetailModel.Phone"></dd>
                                    </dl>
                                    <dl>
                                        <dt>故障描述:</dt>
                                        <dd ng-bind="deviceDetailModel.CreateTime | date : 'yyyy-MM-dd HH:mm:ss'"></dd>
                                    </dl>
                                </div>
                            </div>
                            <div class="thumbs" id="deviceThumbs">
                                <a target-href="{{item.Url}}" style="background-image:url({{item.Url}})" thumbs-list="deviceThumbs" ng-repeat="item in deviceDetailModel.Imgs track by $index"></a>
                            </div>
                        </tab>
                        <tab heading="更改记录">
                            <table class="table table-hover">
                                <thead class="bordered-darkazure">
                                    <tr>
                                        <th rowspan="2">
                                            更改人
                                        </th>
                                        <th rowspan="2">
                                            更改时间
                                        </th>
                                        <th rowspan="2">
                                            更改项目
                                        </th>
                                        <th colspan="2">
                                            更改内容
                                        </th>
                                    </tr>
                                    <tr>
                                        <th>更改前</th>
                                        <th>更改后</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr ng-repeat="item in recordList track by $index">
                                        <td ng-bind="RecordType[item.RecordType]"></td>
                                        <td ng-bind="item.DeviceCode"></td>
                                        <td ng-bind="item.Contact"></td>
                                        <td ng-bind="item.Addr"></td>
                                        <td ng-bind="item.CreateTime | date : 'yyyy-MM-dd HH:mm:ss'"></td>
                                    </tr>
                                    <tr class="no-record" ng-if="recordList.length==0">
                                        <td colspan="5">暂无记录</td>
                                    </tr>
                                </tbody>
                            </table>
                        </tab>
                    </tabset>
                </div>
            </div>
        </div>
    </div>
</div><!-- 编辑设施信息 -->
<div class="modal fade" id="editModal">
    <div class="modal-dialog">
        <form name="deviceForm" ng-submit="deviceFormSubmit()" novalidate>
            <div class="modal-content" ng-show="!isShowGetPosition">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal">
                        <span aria-hidden="true">&times;</span> <span class="sr-only">Close</span>
                    </button>
                    <h4 class="modal-title" ng-bind="editModalTitle"></h4>
                </div>
                <div class="modal-body">
                    <div class="form-group" ng-class="{'has-error' : deviceForm.Name.$dirty&&deviceForm.Name.$invalid}">
                        <div class="input-icon icon-right">
                            <input type="text" name="Name" class="form-control" ng-model="deviceModel.Name" placeholder="隐患编号" required>
                            <p ng-show="deviceForm.Name.$dirty && deviceForm.Name.$error.required" class="help-block">设施名称是必需的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : deviceForm.Code.$dirty&&deviceForm.Code.$invalid}">
                        <div class="input-icon icon-right">
                            <input type="text" name="Code" class="form-control" ng-model="deviceModel.Code" placeholder="隐患描述" required>
                            <p ng-show="deviceForm.Code.$dirty && deviceForm.Code.$error.required" class="help-block">设施编号是必需的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.HandlerId.$dirty&&inspectionForm.HandlerId.$invalid}">
                        <div class="input-icon icon-right">
                            <select name="HandlerId" class="form-control" ng-disabled="id" ng-model="inspectionModel.HandlerId" ng-options="item.Id as item.Name for item in userList" required>
                                <option value="" disabled selected>请选择(上报人员)</option>
                            </select>
                            <p ng-show="inspectionForm.HandlerId.$dirty && inspectionForm.HandlerId.$error.required" class="help-block">处理人员的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-icon icon-right" ng-click="openSetPositionPanel()">
                            <input type="text" value ="坐标为：X: {{ deviceModel.Lng }} Y: {{deviceModel.Lat}} " readonly="readonly" class="form-control map-input" placeholder="隐患地址">
                            <i class="fa fa-map-marker circular"></i>
                        </div>
                        <div class="hidden">
                            <inpu type="text" name="Lng" ng-model = "deviceModel.Lng"></inpu>
                            <inpu type="text" name="Lat" ng-model = "deviceModel.Lat"></inpu>
                        </div>
                    </div>

                    <div class="form-title">选填</div>
                    <div class="checkbox">
                        <label>
                            <input type="checkbox" ng-model="checkbox" class="colored-blue" checked="checked">
                            <span class="text">同步生成维修任务</span>
                        </label>
                    </div>
                    <div class="form-group">
                        <div class="input-icon icon-right">
                            <input ng-disabled="!checkbox" type="text" class="form-control" ng-model="deviceModel.Spec" placeholder="维修编号">
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.MissionLevel.$dirty&&inspectionForm.MissionLevel.$invalid}">
                        <div class="input-icon icon-right">
                            <select ng-disabled="!checkbox" name="MissionLevel" class="form-control" ng-model="inspectionModel.MissionLevel" ng-options="value as key for (key ,value) in MissionLevel" required>
                                <option value="" disabled selected>请选择(紧急程度)</option>
                            </select>
                            <p ng-show="inspectionForm.MissionLevel.$dirty && inspectionForm.MissionLevel.$error.required" class="help-block">紧急程度是必需的，并且不能是空的</p>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="input-icon icon-right">
                            <input ng-disabled="!checkbox" type="text" class="form-control" ng-model="deviceModel.Spec" placeholder="维修要点">
                        </div>
                    </div>
                    <div class="form-group" ng-class="{ 'has-error' : inspectionForm.HandlerId.$dirty&&inspectionForm.HandlerId.$invalid}">
                        <div class="input-icon icon-right">
                            <select ng-disabled="!checkbox" name="HandlerId" class="form-control" ng-disabled="id" ng-model="inspectionModel.HandlerId" ng-options="item.Id as item.Name for item in userList" required>
                                <option value="" disabled selected>请选择(处理人员)</option>
                            </select>
                            <p ng-show="inspectionForm.HandlerId.$dirty && inspectionForm.HandlerId.$error.required" class="help-block">处理人员的，并且不能是空的</p>
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="submit" class="btn btn-primary" ng-disabled="deviceForm.$invalid">确定</button>
                    <button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
                </div>
            </div>
            <div class="modal-content" ng-show="isShowGetPosition">
                <div class="modal-header">
                    <h4 class="modal-title" >请选择位置</h4>
                </div>
                <div class="modal-body">
                    <!--引入设置中心点指令-->
                    <wtmap-get-position option="getPositionOption" position="selectedPosition">

                    </wtmap-get-position>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-primary" ng-click="closeGetPositionPanel()" >确定</button>
                </div>

            </div>

        </form>
    </div>
</div><!-- 删除用户 -->
<div class="modal fade" id="delModal">
    <div class="modal-dialog modal-sm">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal">
                    <span aria-hidden="true">&times;</span> <span class="sr-only">Close</span>
                </button>
                <h4 class="modal-title">确定删除吗?</h4>
            </div>
            <div class="modal-body">
                <div class="panel-info">
                    <dl>
                        <dt>编号:</dt>
                        <dd ng-bind="delModel.Code"></dd>
                    </dl>
                    <dl>
                        <dt>状态:</dt>
                        <dd>
                            <span class="label-warning label" ng-bind="DeviceStatus[delModel.DeviceStatus]"></span>
                        </dd>
                    </dl>
                    <dl>
                        <dt>创建人:</dt>
                        <dd ng-bind="delModel.Contact"></dd>
                    </dl>
                    <dl>
                        <dt>上报时间:</dt>
                        <dd ng-bind="delModel.CreateTime"></dd>
                    </dl>
                    <dl>
                        <dt>地址:</dt>
                        <dd ng-bind="delModel.Addr"></dd>
                    </dl>
                </div>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-warning" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary" ng-click="delConfirm()">确定</button>
            </div>
        </div>
    </div>
</div>
